
<style>
  div#left-up, #left-down, #right-up, #right-down{
        float: left;
        width: 400px;
        padding: 10px 10px 10px 10px;
  }
  div#left-up{
        float: left;
        width: 45%;
        margin-right:10px;
        border:1px solid #C3D2DF;
  }
  div#right-up{
        float: left;
        width: 45%;
        border:1px solid #C3D2DF;
  }
  div#middle{
        float: left;
        width: 95%;
        border:1px solid #C3D2DF;
        padding: 10px 10px 10px 10px;
  }
  div.middle-item{
    float: left;
    margin: 10px 20px 10px 0;
  }
  div#howToUseIt{
    width:70%;
    background-color:#EFF5FF;
    margin: 0 0 10px 0;
    padding: 5px 5px 5px 15px;
  }
  div#bottomDiv{
    float:left;
    width:95%;
    border:1px solid #C3D2DF;
    margin-top:10px;
    padding: 5px 5px 5px 10px;
  }
</style>

<p class="smallNav">
  <%= link_to "专业量表管理", :action => "index"  %>>>
  编辑量表
</p>
<br/>
<div id="howToUseIt">
  <p>
    <font color="#FFAFAF">操作顺序</font>&nbsp;&nbsp;&nbsp;&nbsp;添加分量表 &nbsp;->&nbsp;
    为每个分量表添加题目 &nbsp;->&nbsp; 添加维度 &nbsp;->&nbsp; 编辑维度 &nbsp;->&nbsp;
    定义常模 &nbsp;->&nbsp; 量表制作完成
  <p>
</div>

<div>
  <b>量表名称：<%= @test.name %></b>
  （<font color="red"><%=@question_num%></font>）&nbsp;&nbsp;
  <%= link_to "编辑", {:id => @test, :action => :edit_test} %>
  <!--
  <%= link_to '计分方式', {:id => @test, :action => :edit_count_method } %>&nbsp;&nbsp;
  -->
  <br/><br/>
</div>

<div id="wrapper">

  <div>
      <% if @test.has_part == 1 %>
      <div id="left-up">
          分量表
          <%= link_to '添加分量表', {:id => @test, :action => :new_part } %>
          <br/><br/>

          <% if @test.parts.size == 0 %>
            还没有添加子量表!
          <% else %>

            <!-- 子量表列表 -->
            <% i = 0 %>
            <% @test.parts.each do |part| %>
              <span id="part_<%=part.id%>"><%= part.name %>&nbsp;
                (<font color=red><%= part.questions.size %></font>)
              </span>
              <%= link_to '添加题目', {:id => part.id, :action => :new_questions } %>
              <%= link_to '编辑', {:id => part.id, :action => :edit_part } %>
              <% if i%2==1 %>
              <br/>
              <% else %>
              &nbsp;&nbsp;&nbsp;&nbsp;
              <% end %>
              <% i += 1 %>
            <% end %>
            <!-- 子量表列表结束 -->

          <% end %>
      </div>
      <% end %>

      <% if @test.has_dimen %>
      <div id="right-up">
        维度&nbsp;&nbsp;
        <%=link_to "添加维度", {:id => @test, :action => :new_dimen} %><br/><br/>
        <% @test.dimens.each do |d| %>
          <span id="dimen_<%=d.id%>"><%= d.name %>&nbsp;
            (<font color=red><%= d.questions.size %></font>)
          </span>
          <%= link_to "编辑", :action => "edit_dimen", :id => d%> &nbsp;&nbsp;&nbsp;&nbsp;
          <%= link_to "解释", :action => "explanations", :id => d%> &nbsp;&nbsp;&nbsp;
        <% end %>
        <% if @test.dimens.size == 0 %>
          维度没有定义
        <% end %>
        <br/><br/>
      </div>
      <% end %>

  </div>
  
  <div id="middle" style="margin-top:10px">
    <b>题目</b>&nbsp;&nbsp;
    <% if @test.has_part != 1 %>
    <%= link_to '添加题目', {:id => @test, :action => :new_question } %>
    <% end %>
    <br/><br/>
  
 
  </div>

  <div id="bottomDiv">
    <%= link_to '编辑报告', {:id => @test, :action => :edit_norm } %>&nbsp;&nbsp;
    <% if @test.norm_info.norm_type != NORM_TYPE_TEXT %>
      <%= link_to '添加常模使用说明', {:id => @test, :action => :new_norm_info } %>&nbsp;&nbsp;
    <% end %><br/><br/>
      <p>
        <% @test.norm_info.description %>
        <iframe name="inner" id="inner" src="/user/reports/_report/<%= @test.norm_info.id %>" marginwidth="0" marginheight="0"
                frameborder="0" scrolling="no" width="100%" onload="this.height=this.contentWindow.document.body.scrollHeight+40">
        </iframe>
      </p>
  </div>
</div>
<script>
  function heighlight(el){
    new Effect.Highlight(el, {duration: 2})
  }

  if(null != "<%= flash[:dimen_id] %>" && "" != "<%= flash[:dimen_id] %>") {
    heighlight("dimen_<%= flash[:dimen_id] %>");
  }

  if(null != "<%= flash[:part_id] %>" && "" != "<%= flash[:part_id] %>") {
    heighlight("part_<%= flash[:part_id] %>");
  }

  window.onload = function() {
    
  }
</script>

